﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Advertise
{
    public class RepostQQ : IRepost
    {        private System.Windows.Forms.WebBrowser webBrowser1 = null;
        private LearnNet.Common.XmlHelper xmlHelper = null;
        private static string code = "QQ";
        public RepostQQ(System.Windows.Forms.WebBrowser webBrowser1, LearnNet.Common.XmlHelper xmlHelper)
        {
            this.webBrowser1 = webBrowser1;
            this.xmlHelper = xmlHelper;
        }
        

        public string  Register(RegistEntity regEntity)
        {
            string strReturn = string.Empty;
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/name", regEntity.Name,webBrowser1,xmlHelper))
            {
                strReturn+="名称设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/pwd", regEntity.Pwd,webBrowser1,xmlHelper))
            {
                strReturn+="密码设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/surepwd", regEntity.SurePwd,webBrowser1,xmlHelper))
            {
                strReturn+="确认密码设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/email", regEntity.Email,webBrowser1,xmlHelper))
            {
                strReturn+="电子邮件设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/year", regEntity.Year,webBrowser1,xmlHelper))
            {
                strReturn+="年设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/month", regEntity.Month, webBrowser1, xmlHelper))
            {
                strReturn += "月设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/day", regEntity.Day, webBrowser1, xmlHelper))
            {
                strReturn += "日设置出错!";
            } 
          
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/question", regEntity.Question,webBrowser1,xmlHelper))
            {
                strReturn+="问题设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/answer", regEntity.Answer,webBrowser1,xmlHelper))
            {
                strReturn+="答案设置出错!";
            }
            if (!ReportHelper.SetAttribute("root/station[@code='"+code+"']/register/verificationCode", regEntity.VerificationCode,webBrowser1,xmlHelper))
            {
                strReturn += "验证码设置出错!";
            }
            try
            {
                object obj = webBrowser1.Document.Forms["fReg0"].InvokeMember("submit");
            }
            catch (Exception e)
            {
                strReturn += e.Message;
            }
            return strReturn;
        }

        public string LoginIn(System.Windows.Forms.WebBrowser webBrowser1, RegistEntity regEntity)
        {
            return string.Empty;
        }

        public string Report(System.Windows.Forms.WebBrowser webBrowser1, ReportContent reportContent)
        {
            return string.Empty;
        }
    }
}
